//
//  ZHLEENavViewController.swift
//  ZHLEEBlog_swift_pro
//
//  Created by ZHLEEBlander on 15/10/11.
//  Copyright © 2015年 ZHLEEBlander. All rights reserved.
//

import UIKit

class ZHLEENavViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    override func pushViewController(viewController: UIViewController, animated: Bool) {
        
        
        if childViewControllers.count > 0{
        
            var titleName = "返回"
            
            if childViewControllers.count == 1{
            
                titleName = (childViewControllers.first?.title)!
            }
            
            viewController.hidesBottomBarWhenPushed = true
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem.item(self, action: "back", imageName: "navigationbar_back_withtext", title: titleName)
        }
        
        super.pushViewController(viewController, animated: animated)
    }
    
    @objc private func back(){
    
        popViewControllerAnimated(true)
    }
}
